<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 *客户列表
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$tabs=array(
	array('op'=>'list','title'=>'重复客户列表'),
);
//客户列表
if($_RQ['op']=='list'){
	$list = cache_read('cdata','jy_yxw'.$_SESSION['workerid']);
	if($list){
		foreach($list as $k=>$item){
			if($_RQ['mobile'] && $_RQ['mobile']!=$item['mobile']){
				unset($list[$k]);
			}
		}
	}
	$return['list']=$list;
	//页面显示设置
	$htmls=array(
		'type'=>'list',
		'tabs'=>$tabs,
		'export'=>'export',
		'list'=>array('data'=>'list','tip'=>'[温馨提示]：
		</br>1、下面客户是重复的
		','del_one'=>false,'delall'=>false,'edit'=>false,'list'=>array(
			array('name'=>'title','title'=>'姓名','type'=>'string'),
			array('name'=>'mobile','title'=>'手机','type'=>'string'),
			array('name'=>'type','title'=>'重复原因','type'=>'radio','options'=>'type'),
		)),'search'=>array(
			array('type'=>'string','width'=>'15','title'=>'手机','name'=>'mobile','help'=>''),
		),
	);
	$return['type']=array('未知','交过预成交/定金/成交','同城市的信息重复','该客户已口碑录入');
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='export'){
	$list = cache_read('cdata','jy_yxw'.$_SESSION['workerid']);
	cache_delete('cdata','jy_yxw');
	if($list){
		$types=array('未知','交过预成交/定金/成交','同城市的信息重复','该客户已口碑录入');
		foreach($list as &$item){
			$item['typetitle']=$types[$item['type']];
		}
	}
	$header=array(
		'title'=>'姓名',
		'mobile'=>'手机号',
		'typetitle'=>'重复原因',
	);
	model('core/tools')->export2excel($header,$list,'重复数据');
}